home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmSpeaker
- Caption = "The Speaker Program"
- ClientHeight = 3375
- ClientLeft = 1155
- ClientTop = 1545
- ClientWidth = 7575
- Height = 4065
- Icon = "SPEAKER2.frx":0000
- Left = 1095
- LinkTopic = "Form1"
- ScaleHeight = 3375
- ScaleWidth = 7575
- Top = 915
- Width = 7695
- Begin VB.CommandButton cmdFast
- Caption = "&Fastest"
- Height = 435
- Left = 6720
- TabIndex = 10
- Top = 1620
- Width = 735
- End
- Begin VB.CommandButton cmdNormal
- Caption = "&Normal"
- Height = 435
- Left = 2280
- TabIndex = 9
- Top = 1620
- Width = 735
- End
- Begin VB.CommandButton cmdSlow
- Caption = "S&lowest"
- Height = 435
- Left = 120
- TabIndex = 8
- Top = 1620
- Width = 735
- End
- Begin VB.HScrollBar hsbSpeed
- Height = 255
- Left = 120
- Max = 200
- Min = 50
- TabIndex = 5
- Top = 1320
- Value = 100
- Width = 7335
- End
- Begin VB.CommandButton cmdRewind
- Caption = "&Rewind"
- Height = 855
- Left = 5880
- TabIndex = 4
- Top = 2400
- Width = 1575
- End
- Begin VB.CommandButton cmdPlayMultitask
- Caption = "Play &MultiTask"
- Height = 855
- Left = 2040
- TabIndex = 3
- Top = 2400
- Width = 1575
- End
- Begin VB.CommandButton cmdStop
- Caption = "&Stop"
- Height = 855
- Left = 3960
- TabIndex = 2
- Top = 2400
- Width = 1575
- End
- Begin VB.CommandButton cmdPlay
- Caption = "&Play"
- Height = 855
- Left = 120
- TabIndex = 1
- Top = 2400
- Width = 1575
- End
- Begin VB.Label lblSpeed
- Caption = "Speed: 100"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 120
- TabIndex = 7
- Top = 960
- Width = 1935
- End
- Begin TegoswLibCtl.Tegosw swExit
- Height = 630
- Left = 0
- TabIndex = 6
- Top = 0
- Width = 525
- _version = 65536
- _extentx = 926
- _extenty = 1111
- _stockprops = 64
- value = -1 'True
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 1800
- Top = 120
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- CancelError = -1 'True
- End
- Begin TegspkrLib.TegoSpeaker TegoSpeaker1
- Height = 600
- Left = 720
- TabIndex = 0
- Top = 120
- Width = 930
- _version = 65536
- _extentx = 1640
- _extenty = 1058
- _stockprops = 0
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuOpen
- Caption = "&Open..."
- Enabled = 0 'False
- End
- Begin VB.Menu mnuClose
- Caption = "&Close"
- Enabled = 0 'False
- End
- Begin VB.Menu mnuPlay
- Caption = "&Play"
- End
- Begin VB.Menu mnuSep1
- Caption = "-"
- End
- Begin VB.Menu mnuInfo
- Caption = "&Info..."
- End
- Begin VB.Menu mnuSep2
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- End
- End
- Begin VB.Menu mnuHelp
- Caption = "&Help"
- Begin VB.Menu mnuAbout
- Caption = "About..."
- End
- End
- Attribute VB_Name = "frmSpeaker"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- ' All variables must be declared.
- Option Explicit
- Private Sub cmdFast_Click()
- ' Set the hsbSpeed scrollbar to its maximum value.
- hsbSpeed.Value = hsbSpeed.Max
- End Sub
- Private Sub cmdNormal_Click()
- ' Set the hsbSpeed scrollbar to a value of 100.
- hsbSpeed.Value = 100
- End Sub
- Private Sub cmdPlay_Click()
- ' Play from the beginning of the WAV file until
- ' the end of the WAV file without multitasking,
- ' and disable the mouse during playback.
- TegoSpeaker1.Play 0, -1, 0, False
- End Sub
- Private Sub cmdPlayMultitask_Click()
- ' Play from the current playback position until
- ' the end of the WAV file, with a 300 milliseconds
- ' multitask interval, and enable the mouse during
- ' playback.
- TegoSpeaker1.Play -1, -1, 300, True
- End Sub
- Private Sub cmdRewind_Click()
- ' Rewind the playback position to the beginning
- ' of the WAV file.
- TegoSpeaker1.Seek 0
- End Sub
- Private Sub cmdSlow_Click()
- ' Set the hsbSpeed scrollbar to its minimum value.
- hsbSpeed.Value = hsbSpeed.Min
- End Sub
- Private Sub cmdStop_Click()
- ' Stop the playback.
- TegoSpeaker1.Stop
- End Sub
- Private Sub Form_Load()
- Dim Path
- Dim Filename
- TegoSpeaker1.Visible = False
- ' Get the name of the directory where the
- ' program resides.
- Path = App.Path
- If Right(Path, 1) <> "\" Then
- Path = Path + "\"
- End If
- ' Initially, no WAV file is open, so we execute the
- ' mnuClose_Click() procedure to disable various
- ' controls.
- ''' mnuClose_Click
- ' Open the WAV file.
- Filename = Path + "PEOPLEOF.WAV"
- TegoSpeaker1.Open Filename
- ' If Open command failed, exit this procedure.
- If TegoSpeaker1.GetErrorCode <> 0 Then
- MsgBox TegoSpeaker1.GetErrorMessage
- End
- End If
- ' Display the name of the WAV file (without the path).
- Me.Caption = "The Speaker Program - PeopleOf.WAV"
- ' A WAV file is now open, so enable
- ' the Speed, Close, Info, Play, Stop,
- ' and Rewind controls.
- hsbSpeed.Enabled = True
- cmdSlow.Enabled = True
- cmdFast.Enabled = True
- cmdNormal.Enabled = True
- 'mnuClose.Enabled = True
- mnuInfo.Enabled = True
- cmdPlay.Enabled = True
- cmdPlayMultitask.Enabled = True
- cmdStop.Enabled = True
- cmdRewind.Enabled = True
- ' Set the Speed scrollbar to normal speed.
- hsbSpeed.Value = 100
- End Sub
- Private Sub hsbSpeed_Change()
- ' Updtae the lblSpeed label with the new value of
- ' the hsbSpeed scrollbar.
- lblSpeed.Caption = "Speed: " + Str(hsbSpeed.Value)
- ' Change the playback speed to the speed specified
- ' by the hsbSpeed scrollbar.
- TegoSpeaker1.SetSpeed hsbSpeed.Value
- End Sub
- Private Sub hsbSpeed_Scroll()
- ' Execute the hsbSpeed_Change() procedure.
- hsbSpeed_Change
- End Sub
- Private Sub mnuAbout_Click()
- Dim Title
- Dim Msg
- Dim CR
- CR = Chr(13) + Chr(10)
- ' The title of the About message box.
- Title = "About the Speaker Program"
- ' Prepare the message of the About message box.
- Msg = "This program was written with Visual "
- Msg = Msg + "Basic for Windows, using the "
- Msg = Msg + "TegoSoft Speaker OCX control. "
- Msg = Msg + CR + CR
- Msg = Msg + "The TegoSoft Speaker OCX control "
- Msg = Msg + "is part of the TegoSoft OCX Control "
- Msg = Msg + "Kit - a collection of various OCX controls. "
- Msg = Msg + CR + CR
- Msg = Msg + "For more information about the "
- Msg = Msg + "TegoSoft OCX Control Kit, contact TegoSoft "
- Msg = Msg + "at:"
- Msg = Msg + CR + CR
- Msg = Msg + "TegoSoft Inc." + CR
- Msg = Msg + "P.O. Box 389" + CR
- Msg = Msg + "Bellmore, NY 11710"
- Msg = Msg + CR + CR
- Msg = Msg + "Phone: (516)783-4824"
- ' Display the About message box.
- MsgBox Msg, vbInformation, Title
- End Sub
- Private Sub mnuClose_Click()
- ' Close the WAV file.
- TegoSpeaker1.Close
- ' No WAV file is now open, so disable
- ' the Speed, Close, Info, Play, Stop,
- ' and Rewind controls.
- hsbSpeed.Enabled = False
- cmdSlow.Enabled = False
- cmdFast.Enabled = False
- cmdNormal.Enabled = False
- mnuClose.Enabled = False
- mnuInfo.Enabled = False
- cmdPlay.Enabled = False
- cmdPlayMultitask.Enabled = False
- cmdStop.Enabled = False
- cmdRewind.Enabled = False
- ' Set the title of the program's window.
- Me.Caption = "The Speaker Program"
- End Sub
- Private Sub mnuExit_Click()
- ' Terminate the program.
- Unload Me
- End Sub
- Private Sub mnuInfo_Click()
- Dim Title
- Dim Msg
- Dim CRLF
- CRLF = Chr(13) + Chr(10)
- ' The title of the Info message box.
- Title = "WAV File Information"
- ' Prepare the message for the Info message box.
- Msg = "File Name: " + TegoSpeaker1.GetWavFilename
- Msg = Msg + CRLF
- Msg = Msg + "File Length: " + Str(TegoSpeaker1.GetLength) + " samples."
- Msg = Msg + CRLF
- Msg = Msg + "Sampling Rate: " + Str(TegoSpeaker1.GetSamplingRate) + " Hz."
- Msg = Msg + CRLF
- Msg = Msg + "Number of Bits Per Sample: " + Str(TegoSpeaker1.GetNumBits)
- Msg = Msg + CRLF
- Msg = Msg + "Number of Channels: " + Str(TegoSpeaker1.GetNumChannels)
- ' Display the Info message box.
- MsgBox Msg, vbInformation, Title
- End Sub
- Private Sub mnuOpen_Click()
- ' Set an error trap to detect the clicking
- ' of the Cancel key of the Open dialog box.
- On Error GoTo OpenError
- ' Fill the items of the File Type list box of
- ' the Open dialog box.
- CommonDialog1.Filter = "All Files (*.*)|*.*|Wave Files (*.wav)|*.wav"
- ' Set the default File Type to Wave Files (*.wav).
- CommonDialog1.FilterIndex = 2
- ' Display the Open dialog box.
- CommonDialog1.Action = 1
- ' Remove the error trap.
- On Error GoTo 0
- ' Open the WAV file that the user selected.
- TegoSpeaker1.Open CommonDialog1.Filename
- ' If Open command failed, exit this procedure.
- If TegoSpeaker1.GetErrorCode <> 0 Then
- MsgBox "Cannot open " + CommonDialog1.Filename, 0, "ERROR"
- MsgBox TegoSpeaker1.GetErrorMessage
- mnuClose_Click
- Exit Sub
- End If
- ' Display the name of the WAV file (without the path).
- Me.Caption = "The Speaker Program - " + CommonDialog1.FileTitle
- ' A WAV file is now open, so enable
- ' the Speed, Close, Info, Play, Stop,
- ' and Rewind controls.
- hsbSpeed.Enabled = True
- cmdSlow.Enabled = True
- cmdFast.Enabled = True
- cmdNormal.Enabled = True
- mnuClose.Enabled = True
- mnuInfo.Enabled = True
- cmdPlay.Enabled = True
- cmdPlayMultitask.Enabled = True
- cmdStop.Enabled = True
- cmdRewind.Enabled = True
- ' Set the Speed scrollbar to normal speed.
- hsbSpeed.Value = 100
- ' Exit the procedure.
- Exit Sub
- OpenError:
- ' The user clicked the Cancel button of the
- ' Open File dialog box.
- Exit Sub
- End Sub
- Private Sub mnuPlay_Click()
- cmdPlay_Click
- End Sub
- Private Sub swExit_Click()
- Dim Title
- Dim Question
- Dim Response
- ' If the user turned the swExit switch OFF,
- ' confirm that the user wants to exit the
- ' program, and if so, exit the program.
- If swExit.Value = False Then
- Title = "Exit Program"
- Question = "Are you sure you want to exit?"
- Response = MsgBox(Question, vbYesNo + vbQuestion, Title)
- If Response = vbYes Then
- Unload Me
- Else
- swExit.Value = True
- End If
- End If
- End Sub
- Private Sub TegoSpeaker1_Done()
- ' If current playback position is end of file,
- ' rewind the playback position to the beginning of
- ' the file.
- If TegoSpeaker1.GetPosition = TegoSpeaker1.GetLength Then
- TegoSpeaker1.Seek 0
- End If
- End Sub
-